package com.cff.shorturl.http.handler.inter;

import com.cff.shorturl.http.body.HttpRequestMsg;
import com.cff.shorturl.http.body.HttpResponseMsg;
import com.cff.shorturl.http.handler.ResourceHandler;
import com.cff.shorturl.service.Service;
import com.cff.shorturl.service.ServiceFactory;

public class DefaultResourceHandler extends ResourceHandler {

	@Override
	public HttpResponseMsg handle(HttpRequestMsg httpRequestMsg) {
		String url = httpRequestMsg.getUrl();
		Service service= ServiceFactory.createService(url);
		if(service == null)return null;
		return service.handler(httpRequestMsg);
	}

}
